{template 'common/header'}
<ul class="nav nav-tabs">
    <li ><a href="{php echo url('sms/sendee/list');}">短信接收用户列表</a></li>
    {if $id}
    <li class="active" ><a href="{php echo url('sms/sendee/post');}">修改短信接收用户</a></li>
    {else}
    <li class="active" ><a href="{php echo url('sms/sendee/post');}">增加短信接收用户</a></li>
    {/if}
</ul>
<div class="clearfix">
    <form class="form-horizontal form" action="{php echo url('sms/sendee/post');}" method="post" id="form1">
        <input type="hidden" name="id" value="{$row['id']}" />

        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">用户名称</label>
            <div class="col-sm-5">
                <input type="text" id="sendee" class="form-control" placeholder="请输入用户名称" name="sendee" value="{$row['name']}" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号码</label>
            <div class="col-sm-5">
                <input type="text" id="mobile" class="form-control" name="mobile" value="{$row['mobile']}"  placeholder="请输入手机号码"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">单位职务</label>
            <div class="col-sm-5">
                <input type="text" id="worktitle" class="form-control" name="worktitle" value="{$row['worktitle']}"  placeholder="请输入单位职务"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">设备</label>
            <div class="col-sm-5">
                <select name="messege" class="form-control">
                    {loop $device $k $v}
                    <option value="{$k}">{$v}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
            <div class="col-sm-5" >
                <label class="radio-inline">
                    <input type="radio" name="status" {if $row['status']==1} checked{/if}  value="1"/>
                    启用
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" {if $row['status']==0} checked{/if}  value="0"/>
                    禁用
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
            <div class="col-sm-10">
                <button type="submit" class="btn btn-primary" name="submit" value="提交">提交</button>
                <input type="hidden" name="token" value="{$_W['token']}" />
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    require(['jquery', 'util'], function($, u){
        $("#form1").submit(function(){
            if(!$("#sendee").val()) {
                u.message('用户名称为必填项，请返回修改！！', '', 'error');
                return false;
            }
            if($("#mobile").val() == '') {
                u.message('手机号码为必填项，请返回修改！', '', 'error');
                return false;
            }
            var reg_mobile = /^[0-9]{11}$/;

            if(!reg_mobile.test($("#mobile").val().trim())){
                u.message('手机号码输入不正确，请返回修改！', '', 'error');
                return false;
            }
            if($("#worktitle").val() == '') {
                u.message('单位职务为必填项，请返回修改！', '', 'error');
                return false;
            }
            return true;
        });
    });
</script>
{template 'common/footer'}